package com.vhall.component.service.redpacket.service;


import com.vhall.component.entity.rebroadcast.RedPacketEntity;
import com.vhall.component.entity.rebroadcast.RedPacketRecordEntity;

import java.math.BigDecimal;
import java.util.Set;

/**
 * @author xuyongzheng
 * @since 2021/3/20 22:22
 **/
public interface CacheService {

    void pushToQueue(RedPacketRecordEntity dto);

    void cacheRecords(RedPacketRecordEntity dto);

    Boolean cacheStat(String appId, String sourceId, Long redPacketId, String thirdPartyUserId, BigDecimal amount);

    String popFromQueue(String key, Boolean block, Integer timeOut);

    void clearRedPacketCache(RedPacketEntity redPacket);

    Set<String> selectRedPacketRecords(Long redPacketId, Integer offset, Integer size, String order, String orderType);

    /**
     * 缓存并处理红包实体类信息
     *
     * @param uuid  红包唯一标识ID
     * @param appId PaaS应用ID
     * @return 红包信息
     */
    RedPacketEntity cacheAndHadleRedPacket(String uuid, String appId);
}
